import request from '@/utils/request'

// 创建优惠券
export function createStoreCoupon(data) {
  return request({
    url: '/discount/store-coupon/create',
    method: 'post',
    data: data
  })
}

// 更新优惠券
export function updateStoreCoupon(data) {
  return request({
    url: '/discount/store-coupon/update',
    method: 'put',
    data: data
  })
}

// 删除优惠券
export function deleteStoreCoupon(id) {
  return request({
    url: '/discount/store-coupon/delete?id=' + id,
    method: 'delete'
  })
}

// 获得优惠券
export function getStoreCoupon(id) {
  return request({
    url: '/discount/store-coupon/get?id=' + id,
    method: 'get'
  })
}

// 获得优惠券分页
export function getStoreCouponPage(params) {
  return request({
    url: '/discount/store-coupon/page',
    method: 'get',
    params
  })
}
// 导出优惠券 Excel
export function exportStoreCouponExcel(params) {
  return request({
    url: '/discount/store-coupon/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 更新优惠券状态
export function updateStoreCouponStatus(id, status) {
  return request({
    url: '/discount/store-coupon/update',
    method: 'put',
    data: { id, status }
  })
}

// export function getStoreCouponList(id) {
//   return request({
//     url: '/discount/store-coupon/list',
//     method: 'get',
//     id
//   })
// }
// export function getuserCoupon(params) {
//   return request({
//     url: '/discount/store-coupon/getuserCoupon',
//     method: 'get',
//     params
//   });
// }
// export function getStoreCouponUserPage(params) {
//   return request({
//     url: '/discount/store-coupon-user/page',
//     method: 'get',
//     params
//   })
// }
